package cn.service.Impl;

import cn.dao.UserDao;
import cn.domain.PageBean;
import cn.domain.User;
import cn.service.UserService;
import cn.utils.HQLHelper;
import com.opensymphony.xwork2.ActionContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by jiaxiang Huang on 2017/3/9.
 */
@Service
@Transactional
public class UserServiceImpl implements  UserService {

    @Resource
    private UserDao userDao;
    @Override
    public List<User> findAll() {
        return userDao.findAll();
    }

    @Override
    public User getById(Long id) {
        return userDao.getById(id);
    }

    @Override
    public void delete(Long id) {
        userDao.delete(id);
    }

    @Override
    public void save(User user) {
        userDao.save(user);
    }

    @Override
    public void update(User user) {
        userDao.update(user);
    }

    @Override
    public List<User> getUserName(String username) {
        return userDao.getUserName(username);
    }

    @Override
    public User getLogin(String userName, String password) {
        return userDao.username(userName,password);
    }

    @Override
    public PageBean getPageBean(HQLHelper hqlHelper, int currentPage) {
        return userDao.getPageBean(hqlHelper,currentPage);
    }


}
